<script type="text/javascript">
window.history.forward(1);
</script>
<a href="/order/list" ><div class="topBack"><img src="/images/back_jiantou.png" style="width:40px;height:40px;"></div></a>
<div class="topContent">订单详情</div>
<div class="topRight" >
<?php
$res = $this->res;
if(($res->status == '2' || $res->status == '3') && $res->sale_channel =='1003') {
	echo 
	'<form action="/share/index" method="post">
		<input type="hidden" name="orderId" value="'.$this->oid.'">
		<input type="hidden" name="mobile" value="'.$this->tel.'">
		<input type="submit" value="分享" style="color:white;">
	</form>';
} else {
	echo '&nbsp';
}
?>
</div>
<div class="clear"></div>

<table class="de_title">
	<tr>
		<td><a href="/order/status?oid=<?php echo $this->oid;?>">订单状态</a></td>
		<td class="green_css"><a href="/order/details?act=list&oid=<?php echo $this->oid;?>">订单信息</a></td>
	</tr>
</table>
<div class="beijin"></div>
<div id="wrapperDetails" class="wrapperComman" style="top:85px;bottom:0px;">
<div style="width:100%;">
<?php 
$res = $this->res;
if(!empty($res)){
	echo '
		<div class="greengrocer">
			<table class="lst_tab">
				<tr>
					<td class="greengrocer_top">
						<img class="greengrocer_pic" src="'.$res->logo.'" >
					</td>
					<td class="td_bottom">
						<div class="td_div1">'.$res->clientname.'</div>
						<div class="td_div2">共'.$res->ordercount.'份&nbsp;&nbsp;￥'.$res->custprice.'</div>
						';
						$xiadan = strtotime($res->inserttime);
						$now =time();
						$minute=floor(($now-$xiadan)/60);
						if($minute>60){
							echo '<div class="td_div2"><span>下单日期：'.substr($res->inserttime,5,11).'</span></div>
							</td>';
						}else{
							echo '
							<div class="td_div2"><span>已下单'.$minute.'分钟</span></div>
						</td>';
						}
					$status = $res->status;
					
					echo '
				</tr>
			</table>
		</div>
		<div class="beijin">&nbsp;</div>
		<div class="cp_contact">购买菜品</div>';
		 $oneRow = $res->itemList;
		 if(!empty($oneRow)){
			foreach($oneRow as $one){
				echo '
					<div class="greengrocer">
						<table>
							<tr>
								<td class="greengrocer_top">
									<img class="greengrocer_pic" src="'.$one->imgurl.'" >
								</td>
								<td class="td_bottom">
									<div class="td_div1" style="color:grey;">
										'.$one->skuname.'
									</div>
									<div class="td_div2"><span>'.$one->spec.'</span></div>
									<div class="td_div2" style="color:red;">￥'.$one->total.'</div>
								</td>
								<td style="color:grey;">x'.$one->ordercount.'</td>
							</tr>
						</table>
					</div>
						';
			}
		}
		if(!empty($res->gift)){
			echo '<div class="dt_jian">赠品活动<span>'.$res->gift.'</span></div>';
		}
		if($res->discount>0){
			echo '<div class="dt_jian">满减活动<span>-￥'.$res->discount.'</span></div>';
		}
		
		if($res->voucher>0){
			echo '<div class="dt_jian">现金券<span>￥'.$res->voucher.'</span></div>';
		}
		if($res->presell_discount>0){
			echo '<div class="dt_jian">预约折扣<span>￥'.$res->presell_discount.'</span></div>';
		}
		
		echo '
		<div class="clear"></div>
		<div class="dt_jian">总价<span>￥'.$res->price.'</span></div>
		<div class="dt_jian">实际价格<span>￥'.$res->custprice.'</span></div>
		<div class="beijin">&nbsp;</div>
		<div class="cp_contact">订单信息</div>

		<div class="dt_jian" style="color:grey">'.$res->ordercode.'</div>

		<div class="dt_jian grey">姓名:&nbsp;'.$res->order_contact.'</div>
		<div class="dt_jian grey">手机:&nbsp;'.$res->order_tel.'</div>
		<div class="dt_jian grey">配送方式:&nbsp;';
		if($res->delivery==2){
			echo '送货上门';
		}else{
			echo '到店自提';
		}

		echo'</div>
		<div class="dt_jian grey">支付方式:&nbsp;';
		if($res->payment==2){
			echo '在线支付';
		}else{
			echo '货到付款';
		}
		if($res->sale_channel=='1003'){
			$titletime = "发货时间";
		}else{
			$titletime = '预约时间';
		}
		echo'</div>
		<div class="dt_jian grey">配送地址:&nbsp;'.$res->order_address.'</div>';
		if($res->sale_channel!='1003'){
			echo '<div class="dt_jian grey">'.$titletime.':&nbsp;'.$res->svtime.'</div>';
		}	
		echo '<div class="dt_jian grey">下单时间:&nbsp;'.$res->inserttime.'</div>
		<div class="dt_jian grey">备注信息:&nbsp;'.$res->remark.'</div>';
}else{
		header('Location:/error');
}
?>
</div>
</div>

<script type="text/javascript">
	$(document).ready(function() {
		var myScroll;
		myScroll = new iScroll('wrapperDetails', { scrollbarClass: 'myScrollbar' });
	});
</script>


